package com.loan.market.view

import android.content.Context
import android.util.AttributeSet
import com.github.florent37.singledateandtimepicker.widget.WheelPicker

class NormalWheelView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) : WheelPicker<String>(context, attrs) {


    override fun init() {
        data = ArrayList()
        setCurvedMaxAngle(50)
    }

    override fun initDefault(): String {
        return data.getOrNull(0) ?: ""
    }

    private lateinit var data: ArrayList<String>

    override fun generateAdapterValues(showOnlyFutureDates: Boolean): MutableList<String> {
        return data
    }

    fun setData(data: ArrayList<String>) {
        this.data.clear()
        this.data.addAll(data)
        updateAdapter()
    }

    fun getItem(): String {
        return adapter.getItem(currentItemPosition)
    }
}